package pandabay.domain;

import java.io.Serializable;
import java.util.*;
import java.text.*;


public class Product implements Serializable {

	private int id;
    private String name;
    private String description;
    private Double startPrice;
	private User seller;
    private User highestBidder;
    private String category;
    private String image;
    private ArrayList<Double> bids;
    private String startDate;
    private String endDate;
    
    
    public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public int getId() {
    	return id;
    }
    
    public void setId(int id) {
    	this.id = id;
    }
    
    public ArrayList<Double> getBids() {
    	return bids;
    }
    /*
    public void setBid(double bid) {
    	this.bids.add(bid);
    }*/
    
    public User getSeller() {
		return seller;
	}

	public void setSeller(User seller) {
		this.seller = seller;
	}

	public User getHighestBidder() {
		return highestBidder;
	}

	public void setHighestBidder(User highestBidder) {
		this.highestBidder = highestBidder;
	}
    
    public String getCategory() {
    	return category;
    }
    
    public void setCategory(String category) {
    	this.category = category;
    }
    
    public String getImage() {
    	return image;
    }
    
    public void setImage(String image) {
    	this.image = image;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public Double getStartPrice() {
        return startPrice;
    }
    
    public void setStartPrice(Double startPrice) {
        this.startPrice = startPrice;
    }
    
    public Date getStartDateFormatted(String tmpStartDate){
        Date startDate = null; 
    	try {
    		SimpleDateFormat sdfToDate = new SimpleDateFormat("dd.MM.yyyy");
        	startDate = sdfToDate.parse(tmpStartDate);
        } catch (ParseException ex2) {
        	ex2.printStackTrace();
        }
        return startDate;
    }
    
    public Date getEndDateFormatted(String tmpEndDate){
    	Date endDate = null;
        try {
        	SimpleDateFormat sdfToDate = new SimpleDateFormat("dd.MM.yyyy");
        	endDate = sdfToDate.parse(tmpEndDate);
        } catch (ParseException ex2) {
        	ex2.printStackTrace();
        }
        return endDate;
   }
    
    public String toString() {
        StringBuffer buffer = new StringBuffer();
        buffer.append("Description: " + description + ";");
        buffer.append("StartPrice: " + startPrice);
        return buffer.toString();
    }
}